/*    */ package com.finir.finknjig.forms.controllers;
/*    */ 
/*    */ import java.util.Date;
import java.util.List;

import javax.swing.JOptionPane;

import com.finir.finknjig.forms.BrutoBilans;
import com.finir.finknjig.reports.jasper.ReportsVariables;
import com.finir.finknjig.reports.jasper.Stampanje;
import com.finir.finknjig.service.NalogFacade;
/*    */ 
/*    */ public class BrutoBilansController
/*    */ {
/*    */   private BrutoBilans form;
/*    */   private NalogFacade facade;
/*    */ 
/*    */   public BrutoBilansController(BrutoBilans form)
/*    */   {
/* 27 */     this.form = form;
/* 28 */     this.facade = new NalogFacade();
/*    */   }
/*    */ 
/*    */   private void prikaziPorukuZaPrazanuListu() {
/* 32 */     JOptionPane.showMessageDialog(this.form, 
/* 33 */       "Ni jedan nalog nije evidentiran u tom periodu!", "Info", 
/* 34 */       1);
/*    */   }
/*    */ 
/*    */   public void prikaziBrutoBilans()
/*    */   {
/* 39 */     Date odDatum = this.form.getOddateChooserCombo1().getSelectedDate()
/* 40 */       .getTime();
/* 41 */     Date doDatum = this.form.getDodateChooserCombo2().getSelectedDate()
/* 42 */       .getTime();
/*    */ 
/* 44 */     List nalozi = this.facade.vratiSveNalogeIzmedjuDatuma(odDatum, 
/* 45 */       doDatum);
/*    */ 
/* 47 */     if (nalozi.size() == 0) {
/* 48 */       prikaziPorukuZaPrazanuListu();
/* 49 */       return;
/*    */     }
/*    */ 
/* 52 */     Stampanje s = new Stampanje(this.form);
/* 53 */     s.brutoBilans(nalozi, ReportsVariables.getBrutoBilans(), odDatum, 
/* 54 */       doDatum);
/* 55 */     nalozi = null;
/* 56 */     System.gc();
/*    */   }
/*    */ 
/*    */   public void prikaziZakljucniList()
/*    */   {
/* 62 */     Date odDatum = this.form.getOddateChooserCombo1().getSelectedDate()
/* 63 */       .getTime();
/* 64 */     Date doDatum = this.form.getDodateChooserCombo2().getSelectedDate()
/* 65 */       .getTime();
/*    */ 
/* 67 */     List nalozi = this.facade.vratiSveNalogeIzmedjuDatuma(odDatum, 
/* 68 */       doDatum);
/*    */ 
/* 70 */     if (nalozi.size() == 0) {
/* 71 */       prikaziPorukuZaPrazanuListu();
/* 72 */       return;
/*    */     }
/*    */ 
/* 75 */     Stampanje s = new Stampanje(this.form);
/* 76 */     s.zakljucniList(nalozi, ReportsVariables.getZakljucniList(), odDatum, 
/* 77 */       doDatum);
/* 78 */     nalozi = null;
/* 79 */     System.gc();
/*    */   }
/*    */ }

